package com.base.cn.platform.os.common.logger;

import com.base.cn.platform.os.common.utils.DateUtils;
import lombok.extern.slf4j.Slf4j;

import javax.servlet.http.HttpServletRequest;
import java.math.BigDecimal;
import java.util.Date;

/**
 * 用户活跃日志
 *
 * @author s.li
 * @date 2019/04/19
 */
@Slf4j
public class UserAccessLogger {
    /**
     * 生成用户活跃日志
     * @param request HttpServletRequest
     */
    public static synchronized void genDAULog(HttpServletRequest request,BigDecimal userId , BigDecimal tenantId){
        StringBuilder loginContext = new StringBuilder();
        loginContext.append(DateUtils.format(new Date(),"yyyy-MM-dd")).append("|").append(userId.toString()).append("|").append(tenantId);
        log.info(loginContext.toString());
    }
}
